/*
This code creates Figure 3,
the time series of MA plan payments weighted by national plan type enrollment 
and 2011 eligibles at the county level, dichotomized by benchmark cuts at the 75th percentile
*/

log using "$logs\Fig3.txt", replace text name(fig3)

use "$data_deri\payment_panel", clear

collapse tot_payment_ra [aweight = imp_enrl], by(year q4_prop_flag)
xtset q4_prop_flag year

xtline tot_payment_ra, recast(connected) overlay graphregion(color(white)) plot1opt(lpattern(dash)) scheme(burd) ///
ytitle("Risk-Adjusted MA Payments" "($ per member per month)") ylabel(700(100)1050) ///
ttitle("Year") tlabel(2008(1)2019) ///
tline(2011.5, lcolor(gray)) text(1050 2011.5 "ACA Benchmark" "Reductions Begin", box height(10) bcolor(white)) ///
tline(2016.5, lcolor(gray)) text(1050 2016.5 "ACA Benchmark Reductions" "Fully Phased In", box height(10) bcolor(white)) ///
legend(order(2 "Counties with the Largest Cuts" "(>75th percentile)" 1 "Counties with Smaller Cuts" "({&le}75th percentile)"))

graph export "$output\Fig3.pdf", replace

log close fig3
